const {
  DataTypes
} = require('sequelize');

module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,

      primaryKey: true,
      autoIncrement: true,
      comment: "ID",
      field: "id"
    },
    code: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: true,
      autoIncrement: false,
      comment: "饲料编号",
      field: "code"
    },
    name: {
      type: DataTypes.STRING(30),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "饲料名称",
      field: "name"
    },
    permission: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "生产许可证编号",
      field: "permission"
    },
    date: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "生产日期",
      field: "date"
    },
    main_ingredients: {
      type: DataTypes.STRING(255),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "主要成分",
      field: "main_ingredients"
    },
    out_date: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "保质期",
      field: "out_date"
    },
    person_incharge: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue: '',
      primaryKey: false,
      autoIncrement: false,
      comment: "负责人",
      field: "person_incharge"
    },
    code_unit: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "投喂养殖单元编号",
      field: "code_unit"
    },
    picture: {
      type: DataTypes.STRING(255),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "饲料照片",
      field: "picture"
    },
    isbuy: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "是否购买",
      field: "isbuy"
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "createdAt"
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: true,
 
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "updatedAt"
    },
    deletedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "deletedAt"
    }
  };
  const options = {
    tableName: "feeds_common",
    comment: "",
    indexes: [],
    timestamps: true,
    paranoid: true
  };
  const FeedsCommonModel = sequelize.define("feeds_common_model", attributes, options);
  return FeedsCommonModel;
};